<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;

class TortController extends BaseController
{
    public $validate = [
        "add" => ["rules" => [
            "url" => "required|max:200",
            "type" => "required|in:1,2,3,4",
            "target_id" => "required|max:24",
            "target_type" => "required|in:1,2",
        ]],
    ];

    /**
     * @path /tort/add
     * @category 侵权
     * @title 新增
     * @method POST
     * @params [{"name":"url","type":"text","required":1,"example":"","desc":"侵权链接"},{"name":"type","type":"text","required":1,"example":"","desc":"类型，1侵犯著作权，2侵犯肖像权，3侵犯名誉权，4侵犯隐私权"},{"name":"description","type":"text","required":0,"example":"","desc":"侵权说明"},{"name":"contact","type":"text","required":0,"example":"","desc":"联系方式"},{"name":"file","type":"file","required":0,"example":"","desc":"证明资料"}]
     * @resBody {"success":true,"statusCode":200,"result":true,"message":"OK"}
     */
    public function add(Request $request)
    {
        $params = $request->all();

        $data = service()->TortService->addTort($this->getBaseInfo($params));

        return $this->apiReturn($data);
    }
}
